package org.coody.czone.web.blog.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.coody.czone.common.constant.GeneralFinal;
import org.coody.czone.common.controller.BaseController;
import org.coody.czone.web.blog.domain.JournalInfo;
import org.coody.czone.web.blog.service.JournalService;
import org.coody.czone.web.user.domain.UserTemplate;
import org.coody.framework.core.container.ThreadContainer;
import org.coody.framework.jdbc.entity.Pager;
import org.coody.framework.web.annotation.PathBinding;

@PathBinding("/")
public class GeneralController extends BaseController{

	@Resource
	JournalService journalService;
	
	
	@PathBinding("/index.do")
	public String index(HttpServletRequest request){
		//加载分页文章
		Pager pager=getBeanAll(Pager.class);
		JournalInfo journalInfo=getBeanAll(JournalInfo.class);
		UserTemplate userTemplate=ThreadContainer.get(GeneralFinal.CURRENT_TEMPLATE_INFO);
		pager=journalService.loadPager(userTemplate.getUserId(),journalInfo,pager);
		setAttribute("pager", pager);
		return "index.jsp";
	}
	
	@PathBinding("journals.do")
	public String journals(){
		return "journal_list.jsp";
	}
	
	@PathBinding("articles.do")
	public String articles(){
		return "index.html";
	}
}
